<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <ul class="pagination">
        <li class="prev"><a href="#">< Prev</a></li>
        <li class="pageNumber active"><a href="#">1</a></li>
        <li class="pageNumber"><a href="#">2</a></li>
        <li class="pageNumber"><a href="#">3</a></li>
        <li class="pageNumber"><a href="#">4</a></li>
        <li class="pageNumber"><a href="#">5</a></li>
        <li><a href="#" class="next">Next ></a></li>
    </ul>
</body>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(document).on('click', '.next', function () {
            $('.pagination').find('.pageNumber.active').next().addClass('active')
            $('.pagination').find('.pageNumber.active').prev().removeClass('active')
        })
        $('.prev').click(function () {
            $('.pagination').find('.pageNumber.active').next().removeClass('active')
            $('.pagination').find('.pageNumber.active').prev().addClass('active')
        })
    })
</script>
</html>